home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / QD3DShader.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  7.6 KB  |  273 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DShader.h                                             **
  4.  **                                                                             **
  5.  **                                                                             **
  6.  **     Purpose:     QuickDraw 3D Shader / Color Routines                     **
  7.  **                                                                             **
  8.  **                                                                             **
  9.  **                                                                             **
  10.  **     Copyright (C) 1991-1997 Apple Computer, Inc. All rights reserved.     **
  11.  **                                                                             **
  12.  **                                                                             **
  13.  *****************************************************************************/
  14. #ifndef QD3DShader_h
  15. #define QD3DShader_h
  16.  
  17. #include "QD3D.h"
  18.  
  19. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  20.     #pragma once
  21. #endif
  22.  
  23. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  24.  
  25. #if defined(__xlc__) || defined(__XLC121__)
  26.     #pragma options enum=int
  27.     #pragma options align=power
  28. #elif defined(__MWERKS__)
  29.     #pragma enumsalwaysint on
  30.     #pragma options align=native
  31. #elif defined(__MRC__) || defined(__SC__)
  32.     #if __option(pack_enums)
  33.         #define PRAGMA_ENUM_RESET_QD3DSHADER 1
  34.     #endif
  35.     #pragma options(!pack_enums)
  36.     #pragma options align=power
  37. #endif
  38.  
  39. #endif  /* OS_MACINTOSH */
  40.  
  41. #ifdef __cplusplus
  42. extern "C" {
  43. #endif    /* __cplusplus */
  44.  
  45. /******************************************************************************
  46.  **                                                                             **
  47.  **                                RGB Color routines                             **
  48.  **                                                                             **
  49.  *****************************************************************************/
  50.  
  51. QD3D_EXPORT TQ3ColorRGB *QD3D_CALL Q3ColorRGB_Set(
  52.     TQ3ColorRGB            *color,
  53.     float                r,
  54.     float                g,
  55.     float                b);
  56.  
  57. QD3D_EXPORT TQ3ColorARGB *QD3D_CALL Q3ColorARGB_Set(
  58.     TQ3ColorARGB        *color,
  59.     float                a,
  60.     float                r,
  61.     float                g,
  62.     float                b);
  63.  
  64. QD3D_EXPORT TQ3ColorRGB *QD3D_CALL Q3ColorRGB_Add(
  65.     const TQ3ColorRGB     *c1, 
  66.     const TQ3ColorRGB     *c2,
  67.     TQ3ColorRGB            *result);
  68.  
  69. QD3D_EXPORT TQ3ColorRGB *QD3D_CALL Q3ColorRGB_Subtract(
  70.     const TQ3ColorRGB     *c1, 
  71.     const TQ3ColorRGB     *c2,
  72.     TQ3ColorRGB            *result);
  73.  
  74. QD3D_EXPORT TQ3ColorRGB *QD3D_CALL Q3ColorRGB_Scale(
  75.     const TQ3ColorRGB     *color, 
  76.     float                scale,
  77.     TQ3ColorRGB            *result);
  78.  
  79. QD3D_EXPORT TQ3ColorRGB *QD3D_CALL Q3ColorRGB_Clamp(
  80.     const TQ3ColorRGB     *color,
  81.     TQ3ColorRGB            *result);
  82.  
  83. QD3D_EXPORT TQ3ColorRGB *QD3D_CALL Q3ColorRGB_Lerp(
  84.     const TQ3ColorRGB     *first, 
  85.     const TQ3ColorRGB     *last, 
  86.     float                 alpha,
  87.     TQ3ColorRGB         *result);
  88.  
  89. QD3D_EXPORT TQ3ColorRGB *QD3D_CALL Q3ColorRGB_Accumulate(
  90.     const TQ3ColorRGB     *src, 
  91.     TQ3ColorRGB         *result);
  92.  
  93. QD3D_EXPORT float *QD3D_CALL Q3ColorRGB_Luminance(
  94.     const TQ3ColorRGB    *color, 
  95.     float                 *luminance);
  96.  
  97.  
  98. /******************************************************************************
  99.  **                                                                             **
  100.  **                                Shader Types                                 **
  101.  **                                                                             **
  102.  *****************************************************************************/
  103.  
  104. typedef enum TQ3ShaderUVBoundary {
  105.     kQ3ShaderUVBoundaryWrap,
  106.     kQ3ShaderUVBoundaryClamp
  107. } TQ3ShaderUVBoundary;
  108.  
  109.  
  110. /******************************************************************************
  111.  **                                                                             **
  112.  **                                Shader Routines                                 **
  113.  **                                                                             **
  114.  *****************************************************************************/
  115.  
  116. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Shader_GetType(
  117.     TQ3ShaderObject            shader);
  118.  
  119. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shader_Submit(
  120.     TQ3ShaderObject            shader, 
  121.     TQ3ViewObject            view);
  122.  
  123. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shader_SetUVTransform(
  124.     TQ3ShaderObject            shader,
  125.     const TQ3Matrix3x3        *uvTransform);
  126.  
  127. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shader_GetUVTransform(
  128.     TQ3ShaderObject            shader,
  129.     TQ3Matrix3x3            *uvTransform);
  130.  
  131. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shader_SetUBoundary(
  132.     TQ3ShaderObject            shader,
  133.     TQ3ShaderUVBoundary        uBoundary);
  134.  
  135. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shader_SetVBoundary(
  136.     TQ3ShaderObject            shader,
  137.     TQ3ShaderUVBoundary        vBoundary);
  138.  
  139. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shader_GetUBoundary(
  140.     TQ3ShaderObject            shader,
  141.     TQ3ShaderUVBoundary        *uBoundary);
  142.  
  143. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shader_GetVBoundary(
  144.     TQ3ShaderObject            shader,
  145.     TQ3ShaderUVBoundary        *vBoundary);
  146.  
  147.  
  148. /******************************************************************************
  149.  **                                                                             **
  150.  **                            Illumination Shader    Classes                         **
  151.  **                                                                             **
  152.  *****************************************************************************/
  153.  
  154. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3IlluminationShader_GetType(
  155.     TQ3ShaderObject                shader);
  156.  
  157. QD3D_EXPORT TQ3ShaderObject QD3D_CALL Q3PhongIllumination_New(
  158.     void);
  159.  
  160. QD3D_EXPORT TQ3ShaderObject QD3D_CALL Q3LambertIllumination_New(
  161.     void);
  162.  
  163. QD3D_EXPORT TQ3ShaderObject QD3D_CALL Q3NULLIllumination_New(
  164.     void);
  165.  
  166.  
  167. /******************************************************************************
  168.  **                                                                             **
  169.  **                                 Surface Shader                                 **
  170.  **                                                                             **
  171.  *****************************************************************************/
  172.  
  173. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3SurfaceShader_GetType(
  174.     TQ3SurfaceShaderObject        shader);
  175.  
  176.  
  177. /******************************************************************************
  178.  **                                                                             **
  179.  **                                Texture Shader                                 **
  180.  **                                                                             **
  181.  *****************************************************************************/
  182.  
  183. QD3D_EXPORT TQ3ShaderObject QD3D_CALL Q3TextureShader_New(
  184.     TQ3TextureObject            texture);
  185.  
  186. QD3D_EXPORT TQ3Status QD3D_CALL Q3TextureShader_GetTexture(
  187.     TQ3ShaderObject                shader,
  188.     TQ3TextureObject            *texture);
  189.  
  190. QD3D_EXPORT TQ3Status QD3D_CALL Q3TextureShader_SetTexture(
  191.     TQ3ShaderObject                shader,
  192.     TQ3TextureObject            texture);
  193.  
  194.  
  195. /******************************************************************************
  196.  **                                                                             **
  197.  **                                Texture Objects                                 **
  198.  **                                                                             **
  199.  *****************************************************************************/
  200.  
  201. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Texture_GetType(
  202.     TQ3TextureObject        texture);
  203.  
  204. QD3D_EXPORT TQ3Status QD3D_CALL Q3Texture_GetWidth(
  205.     TQ3TextureObject        texture,
  206.     unsigned long            *width);
  207.  
  208. QD3D_EXPORT TQ3Status QD3D_CALL Q3Texture_GetHeight(
  209.     TQ3TextureObject        texture,
  210.     unsigned long            *height);
  211.  
  212.  
  213. /******************************************************************************
  214.  **                                                                             **
  215.  **                                Pixmap Texture                                 **
  216.  **                                                                             **
  217.  *****************************************************************************/
  218.  
  219. QD3D_EXPORT TQ3TextureObject QD3D_CALL Q3PixmapTexture_New(
  220.     const TQ3StoragePixmap    *pixmap);
  221.  
  222. QD3D_EXPORT TQ3Status QD3D_CALL Q3PixmapTexture_GetPixmap(
  223.     TQ3TextureObject        texture,
  224.     TQ3StoragePixmap        *pixmap);
  225.  
  226. QD3D_EXPORT TQ3Status QD3D_CALL Q3PixmapTexture_SetPixmap(
  227.     TQ3TextureObject        texture,
  228.     const TQ3StoragePixmap    *pixmap);
  229.  
  230.  
  231. /******************************************************************************
  232.  **                                                                             **
  233.  **                                Mipmap Texture                                 **
  234.  **                                                                             **
  235.  *****************************************************************************/
  236.  
  237. QD3D_EXPORT TQ3TextureObject QD3D_CALL Q3MipmapTexture_New(
  238.     const TQ3Mipmap            *mipmap);
  239.  
  240. QD3D_EXPORT TQ3Status QD3D_CALL Q3MipmapTexture_GetMipmap(
  241.     TQ3TextureObject        texture,
  242.     TQ3Mipmap                *mipmap);
  243.  
  244. QD3D_EXPORT TQ3Status QD3D_CALL Q3MipmapTexture_SetMipmap(
  245.     TQ3TextureObject        texture,
  246.     const TQ3Mipmap            *mipmap);
  247.  
  248.  
  249.  
  250. #ifdef __cplusplus
  251. }
  252. #endif    /* __cplusplus */
  253.  
  254. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  255.  
  256. #if defined(__xlc__) || defined(__XLC121__)
  257.     #pragma options enum=reset
  258.     #pragma options align=reset
  259. #elif defined(__MWERKS__)
  260.     #pragma enumsalwaysint reset
  261.     #pragma options align=reset
  262. #elif defined(__MRC__) || defined(__SC__)
  263.     #if PRAGMA_ENUM_RESET_QD3DSHADER
  264.         #pragma options(pack_enums)
  265.         #undef PRAGMA_ENUM_RESET_QD3DSHADER
  266.     #endif
  267.     #pragma options align=reset
  268. #endif
  269.  
  270. #endif  /* OS_MACINTOSH */
  271.  
  272. #endif  /*  QD3DShader_h  */
  273.